package io.github.lee.jel.utils

import android.content.Context
import android.util.Size
import kotlin.math.roundToInt

fun screenSize(context: Context): Size {
    return Size(
        context.resources.displayMetrics.widthPixels,
        context.resources.displayMetrics.heightPixels
    )
}

fun screenWidthDP(context: Context): Int {
    val width = context.resources.displayMetrics.widthPixels
    val density = context.resources.displayMetrics.density
    return (width * 1.0F / density).roundToInt()
}

fun screenHeightDP(context: Context): Int {
    val height = context.resources.displayMetrics.heightPixels
    val density = context.resources.displayMetrics.density
    return (height * 1.0F / density).roundToInt()
}